package com.youhong.teethcare.plaque.dialogs;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.youhong.teethcare.R;
import com.youhong.teethcare.utils.ScreenUtils;

import java.util.zip.Inflater;

/**
 * Created by Administrator on 2018/9/11.
 */

public class BleedingDialog extends Dialog {

    public void setRunnable_understand(Runnable runnable_understand) {
        this.runnable_understand = runnable_understand;
    }

    Runnable runnable_understand;
    TextView tv_understand;

    public BleedingDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        setContentView(R.layout.dialog_bleeding);
        initWidth(context);

        getViews();
    }

    protected void initWidth(Context context) {
        int width = (int) (ScreenUtils.getScreenWidth(context)*0.85f);
        ViewGroup.LayoutParams lay = getWindow().getAttributes();
        lay.width = width;
    }

    public BleedingDialog(@NonNull Context context) {
        super(context);
        setContentView(R.layout.dialog_bleeding);
        getViews();
    }

    private void getViews() {


        tv_understand = findViewById(R.id.bleeding_tv_ok);
        tv_understand.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (runnable_understand != null)
                    runnable_understand.run();

                BleedingDialog.this.dismiss();
            }
        });
    }

}
